import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: 
	{
		token: '',
		userid: '',
		corp: '',
		doamin: '',
		language: '',
		//客户正式环境
		urlList:{
			//新登录，修改密码地址
			baseUrl:'http://localhost:5151',
			//部署mrs网页地址
			mrsUrl:'/static/appPage/',
			mrs2:'',
			ajaxLog: 'http://HeartBeat:8110/LOG/PostValue',
			//apk地址
			apkUrl:'',
			configUrl:'http://dwh.ap.autoliv.int/nacosconf',
			environment:'Prod',
			version:'1.0.0'
			// //新登录，修改密码地址
			// baseUrl:'http://dwh/appplat/APPPlatWebService.asmx',
			// //部署mrs网页地址
			// mrsUrl:'/static/appPage/',
			// mrs2:'http://dwh/mrsweb/WebServiceMRSII.asmx',
			// ajaxLog: 'http://HeartBeat:8110/LOG/PostValue',
			// //apk地址
			// apkUrl:'http://dwh.ap.autoliv.int/APK/WMS3.0_PROD.apk',
			// environment:'Prod',
			// version:'3.0.28'
		},
		All:{
			WCS: 'http://localhost:5152',
		}
	},
	getters: {
		getToken: state => state.token,
		getBaseUrl: state => state.urlList.baseUrl,
		getMrsUrl: state => state.urlList.mrsUrl,
		getApkUrl: state => state.urlList.apkUrl,
		getEnvironment: state => state.urlList.environment,
		getVersion: state => state.urlList.version,
		getMrs2: state => state.urlList.mrs2,
		getUserid: state => state.userid,
		getLanguage: state => state.language,
		getCorp: state => state.getCorp,
		getDomain: state => state.domain,
		getConfigUrl: state => state.urlList.configUrl,
		getAjaxLog: state => state.urlList.ajaxLog,
		getAll: state => state.All
	},
	mutations: {
		SET_USERID(state, userid) {
				state.userid = userid
			},
			SET_LANGUAGE(state, language) {
				state.language = language
			},
			SET_CORP(state, corp) {
				state.corp = corp
			},
			SET_TOKEN(state, token) {
				state.token = token
			},
			SET_DOMAIN(state, domain) {
				state.domain = domain
			},
			SET_ALL(state, all) {
				state.All = all
			},
			SET_BASEURL(state, baseUrl) {
				state.urlList.baseUrl = baseUrl
			},
			SET_AJAXLOG(state, ajaxLog) {
				state.urlList.ajaxLog = ajaxLog
			},
			SET_APKURL(state, apkUrl) {
				state.urlList.apkUrl = apkUrl
			}
		},
		actions: {
			setToken({commit},token){
				commit('SET_TOKEN', token)
			},
			setDomain({commit},domain){
				commit('SET_DOMAIN', domain)
			},
			setUserid({commit},userid){
				commit('SET_USERID', userid)
			},
			setLanguage({commit},language){
				commit('SET_LANGUAGE', language)
			},
			setCorp({commit},corp){
				commit('SET_CORP', corp)
			},
			setAll({commit},all){
				commit('SET_ALL', all)
			},
			setBaseUrl({commit},baseUrl){
				commit('SET_BASEURL', baseUrl)
			},
			setAjaxLog({commit},ajaxLog){
				commit('SET_AJAXLOG', ajaxLog)
			},
			setApkUrl({commit},apkUrl){
				commit('SET_APKURL', apkUrl)
			}
		}
})

export default store
